package com.cxyxj.aopxml;

import org.aspectj.lang.JoinPoint;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class ProductAspect {
    private static final String Pattern = "yyyy-MM-dd HH:mm:ss";
    public void before(JoinPoint joinPoint){
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Pattern);
        String timeStr = now.format(formatter);
        System.out.println("方法执行开始时间：" + timeStr);
    }

    public void after(JoinPoint joinPoint){
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Pattern);
        String timeStr = now.format(formatter);
        System.out.println("方法执行完成时间：" + timeStr);
    }
}
